import torch
import torch.nn as nn
import numpy as np
import cv2 as cv
from model.shufflenet import ShuffleNet
from model.fpn import ZhnNetFpn
from model.head import ZhnNetHead
from model.decode import decode_box


class ZhnNet(nn.Module):
    def __init__(self, classify=False, device=torch.device('cpu')):
        super().__init__()
        self.backbone = ShuffleNet()
        self.fpn = ZhnNetFpn()
        self.head = ZhnNetHead(classify, device)
        self.classify = classify

    def forward(self, x):
        x = self.backbone(x)
        if not self.classify:
            x = self.fpn(x)
        x = self.head(x)
        return x
